package org.corey.wyp.command
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	
	import mx.controls.Alert;
	import mx.rpc.IResponder;
	
	import org.corey.wyp.business.PropertyManagerDelegate;
	import org.corey.wyp.event.MonthSettingShowEvent;
	import org.corey.wyp.model.ProperityModelLocator;
	import org.corey.wyp.vo.MonthSetting;
		

	public class MonthSettingShowCommand implements ICommand,IResponder
	{
		public function MonthSettingShowCommand()
		{
		}
		
		public function execute(event:CairngormEvent):void{
			var showEvent:MonthSettingShowEvent=MonthSettingShowEvent(event);
			var year:int=showEvent.year;
			var month:int=showEvent.month;
			var pm:PropertyManagerDelegate=new PropertyManagerDelegate(this);
			pm.getMonthSetting(year,month);
		}
		
		public function result(event:Object):void{
			var m:MonthSetting=MonthSetting(event.result);
			if(m==null){
				m=new MonthSetting();
			}
				ProperityModelLocator.getInstance().application.monthSetting=m;
		}
		
		public function fault(info:Object):void{
			Alert.show("增加信息失败:"+info);
		}


	}
}